//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "DGConvectBC.h"

// MOOSE includes
#include "MooseVariableFE.h"

#include "libmesh/numeric_vector.h"
#include "libmesh/utility.h"

// C++ includes
#include <cmath>

registerMooseObject("snakeApp", DGConvectBC);

template <>
InputParameters
validParams<DGConvectBC>()
{
  InputParameters params = validParams<IntegratedBC>();
  params.addRequiredParam<Real>("hw", "The value the variable should have on the boundary");
  params.addRequiredParam<Real>("Tw", "The value the variable should have on the boundary");
  
   return params;
}

DGConvectBC::DGConvectBC(const InputParameters & parameters)
  : IntegratedBC(parameters),
    _hw(getParam<Real>("hw")),
    _Tw(getParam<Real>("Tw"))  
{
}

Real
DGConvectBC::computeQpResidual()
{
 
  Real r = 0;
  r += _hw * (_u[_qp] - _Tw) * _test[_i][_qp];
  //-(_grad_u[_qp] * _normals[_qp]);
   return r;
}

Real
DGConvectBC::computeQpJacobian()
{
  Real r = 0;
  r += _hw * _phi[_j][_qp] * _test[_i][_qp];
  //-_grad_phi[_j][_qp] * _normals[_qp] * _test[_i][_qp];
  return r;
}
